package com.example.park2212.points

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.lib_base.entity.*
import com.example.park2212.R

class PpAdapter:BaseQuickAdapter<PatrolTaskBeanItem,BaseViewHolder>(R.layout.item_point_oatrol) {
    override fun convert(helper: BaseViewHolder, item: PatrolTaskBeanItem) {
        helper.setText(R.id.pp_rw,item.taskName)
        helper.setText(R.id.pp_status,item.patrolStatus)
        helper.setText(R.id.pp_time,"任务时间：${item.patrolTime}")

        val tv_status = helper.getView<TextView>(R.id.pp_status)
        if (item.patrolStatus == "0"){
            tv_status.setText("未巡检")
            tv_status.setBackgroundResource(R.drawable.shape_status)
        }else if (item.patrolStatus == "1"){
            tv_status.setText("巡检中")
            tv_status.setBackgroundResource(R.drawable.shape_weihu)
        }else if (item.patrolStatus == "2"){
            tv_status.setText("已完成")
            tv_status.setBackgroundResource(R.drawable.shape_zhanyong)
        }else if (item.patrolStatus == "3"){
            tv_status.setText("已作废")
            tv_status.setBackgroundResource(R.drawable.shape_solid_darkgreen)
        }
    }
}